﻿//======================================================================
//
//        Copyright (C) 2008 HOHO``
//        All rights reserved
//
//        filename :$safeitemrootname$
//        description :管理员操作，账户添加。
//
//        created by 裘中杰 at  $time$
//======================================================================

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Hisun.Models;
using Hisun.Controllers;

namespace Hisun.View.Admin
{
    public partial class AccountAdd : AbcPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void lnkBtnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(DutyDeptSelect1.txtDutyDeptID.Text))
            {
                throw new Exception("没有选择责任部门ID");
            }
            string username = Session[ServerVars.sysSessionUserName].ToString();
            AbcAccount abcAccount = new AbcAccount(username);
            if (abcAccount.Create(txtOperatorID.Text, txtRealname.Text, txtPassword.Text, txtCompanyID.Text, DutyDeptSelect1.txtDutyDeptID.Text) != 0)
            {
                throw new Exception(abcAccount.LastError);
            }
        }
    }
}
